//
//  CBWTabBarController.swift
//  weibo
//
//  Created by 陈博文 on 16/5/25.
//  Copyright © 2016年 陈博文. All rights reserved.
//

import UIKit

class CBWTabBarController: UITabBarController {

    
    // MARK:=============== lifecircle ===============
    override func viewDidLoad() {
        super.viewDidLoad()
        self.tabBar.tintColor = UIColor.orangeColor()
        
        self.addsubViewControllers()

           }

    
    
    
    // MARK:=============== private ===============
    
    
    func addsubViewControllers() {
        
        let indexViewController = CBWIndexViewController()
        let navigationCtroller1 = CBWNavigationController(rootViewController: indexViewController)
        navigationCtroller1.tabBarItem = UITabBarItem(title: "首页", image:  UIImage(named: "tabbar_home"), selectedImage: UIImage(named: "tabbar_home_highlighted"))
        self.addChildViewController(navigationCtroller1)
        
        let messageViewController = CBWMessageViewController()
        let navigationCtroller2 = CBWNavigationController(rootViewController: messageViewController)
        navigationCtroller2.tabBarItem = UITabBarItem(title: "发现", image:  UIImage(named: "tabbar_message_center"), selectedImage: UIImage(named: "tabbar_message_center_highlighted"))
        self.addChildViewController(navigationCtroller2)
        
        let discoverViewController = CBWDiscoveryViewController()
        let navigationCtroller3 = CBWNavigationController(rootViewController: discoverViewController)
        navigationCtroller3.tabBarItem = UITabBarItem(title: "搜索", image:  UIImage(named: "tabbar_discover"), selectedImage: UIImage(named: "tabbar_discover_highlighted"))
        self.addChildViewController(navigationCtroller3)
        
        let meViewController = CBWMeViewController()
        let navigationCtroller4 = CBWNavigationController(rootViewController: meViewController)
        navigationCtroller4.tabBarItem = UITabBarItem(title: "我的", image:  UIImage(named: "tabbar_profile"), selectedImage: UIImage(named: "tabbar_profile_highlighted"))
        self.addChildViewController(navigationCtroller4)
        
    }
  
}
